﻿<UserControl x:Class="WpfApplication1.TaskModule.TasksView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" Width="442.231">
    <Grid>

        <StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Margin="2,6">
                    <Hyperlink Command="{Binding ReadCommand}">
                        <TextBlock FontSize="18" Text="Read" />
                    </Hyperlink>
                </TextBlock>
                <Separator />
                <TextBlock Margin="2,6">
                    <Hyperlink Command="{Binding DeleteCommand}"
                               CommandParameter="{Binding SelectedItem, ElementName=listView}">
                        <TextBlock FontSize="18" Text="Delete" />
                    </Hyperlink>
                </TextBlock>
                <Separator />
                <TextBlock Margin="2,6">
                    <Hyperlink Command="{Binding UpdateCommand}"
                               CommandParameter="{Binding SelectedItem,ElementName=listView}">
                        <TextBlock FontSize="18" Text="Save" />
                    </Hyperlink>
                </TextBlock>
            </StackPanel>
            <ListView Name="listView" IsSynchronizedWithCurrentItem="True" Margin="10"
                      ItemsSource="{Binding Items}"
                      SelectedItem="{Binding SelectedItem}">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Id" Width="120">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Id}" Foreground="Blue" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Header="Name" Width="150" DisplayMemberBinding="{Binding Name}" />
                        <GridViewColumn Header="Notes" Width="250" DisplayMemberBinding="{Binding Notes}" />
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel>
                <TextBox Text="{Binding SelectedItem.Name}" />
                <TextBox Text="{Binding SelectedItem.Notes}" />
            </StackPanel>
        </StackPanel>


    </Grid>
</UserControl>